<template>
	<view class="myBody " >
		<view  :style="'margin-top:' + demo +'px;'" class="mytop">
			<div class="user_border" @click="user_dital">
				<div class="user_img">
					<image :src="userInfo.avatar"></image>
				</div>
				<div class="user_text">
					<view>{{userInfo.realName}}</view>
					<view>{{userInfo.officeName}}</view>
				</div>
				<div>
					<i class="iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu-"></i>
				</div>
			</div>
		</view>
		<div>
			<mylist :datasoce="seziList" @runIndex="runIndex"></mylist>
		</div>
		<!-- 设置 -->
		<div>
			<mylist :datasoce="seziUp_list" @runIndex="setUp"></mylist>
		</div>
		<div class="footer"> 
			<div class="footer_text">
				<div class="footer_txt">
					<i class="iconfont icon-diannao icon_style"></i><text>网页版：<a href="#" style="color: #2283e4;padding-right: 10px;">http://www.sibanyun.com</a></text>
				</div>
				<div class="footer_txt">
					<i class="iconfont icon-shouye1 icon_style"></i><text>官&nbsp;&nbsp;&nbsp;&nbsp;网：<a href="#" style="color: #2283e4;padding-right: 10px;">http://www.sibanyun.cn</a></text>
				</div>
				<div class="footer_txt">
					<i class="iconfont icon-dianhua4 icon_style"></i>
					<text>服务电话：<a href="tel:023-68888995" style="color: #2283e4;padding-right: 10px;">023-68888995</a><a href="tel:13918806563" style="color: #2283e4;">13918806563</a></text>
				</div>
			</div>
		</div>
		<popus ref="alert" >
			<div :style="alertWidth">
				<share @colose="colose" :data="data"></share>
			</div>
		</popus>
	
	</view>

</template>

<script>
	import popus from '@/uni_modules/uni-popup/components/uni-popup/uni-popup'
	import share from '@/pages/common/my/subpage/share/share'
	import {logout,getUserInfo} from '@/common/api/table.js'
	import mylist from '@/components/my-list/list'
	//获取用户基本信息
	export default {
		components:{
			mylist,
			popus,
			share,
		},
		data() {
			return {
				userInfo: {},
				seziList: [
					{
						icon: 'iconfont icon-fenxiang1',
						name:'乐分享'
					},
					{
						icon: 'iconfont icon-xunwen',
						name: '问大牛'
					},
					{
						icon: 'iconfont icon-jishiben',
						name: '记事本',
					}
				],
				seziUp_list: [
					{
						icon: 'iconfont icon-shezhi',
						name: '设置',
					}
				],
				alertWidth: '',
				data: '',
				demo: 40,
			}
		},
		mounted() {
			
			 this.demo = uni.getSystemInfoSync().statusBarHeight;
			
			let _this = this;
			uni.getSystemInfo({
			    success: function (res) {
					_this.alertWidth = 'width:' + res.windowWidth + 'px;'
			    },
				
			});
			
		},

		onShow() {
			
			getUserInfo().then(item => {
				if(item.code == 200){
					console.log(item)
					this.userInfo = item.data;
				}
			})
			
			// if(userInfo){
			// 	//没有头像使用默认头像
			// 	if(userInfo.avatar==null){
			// 		userInfo.avatar = '../../static/image/boy.png';
			// 	};
			// }
		},

		methods: {
			
			// 设置
			setUp(){
				uni.navigateTo({
					url: '/pages/my/subpage/set_list'
				})
			},
			
			runIndex(val){
				this.szTap(val);
			},
			
			// footer 链接
			set_open(val){
				if(val == 1){
					plus.runtime.openURL("https://shang.qq.com/wpa/qunwpa?idkey=7af3f92235c812071a14294704e4f2859a381655d1d0f88b1111800d9a462ecc");
				}
				if(val == 2){
					plus.runtime.openURL("https://shang.qq.com/wpa/qunwpa?idkey=05257c4a1c4489b8891845a9baa2700d825e79b7b8955b018c42ecc99d8ff27a");
				}
				if(val == 3){
					plus.runtime.openURL('http://wpa.qq.com/msgrd?v=3&uin=584418600&site=qq&menu=yes');
				}
			},
			
			
			
			colose(){
				this.$refs.alert.close()
			},
			
			evalua(){
					this.$refs.evaluate.close()
			},
			
			// 用户详情跳转
			user_dital(){
				uni.navigateTo({
					url:'/pages/common/my/my-details'
				})
			},
			
			szTap(index){
				if(index==0){ // 分享
					this.$refs.alert.open('left')
					this.data = '快乐分享';
				}else if(index==1){	// 问大牛
					// uni.navigateTo({
					// 	url:'../../components/user-sz/user-sz'
					// })
				
				}else if(index==2){ //记事本
					uni.redirectTo({
						url: '/pages/common/my/subpage/evaluate/evaluate?title=记事本'
					})
				}else if(index == 3){ // 设置
					
				}else if(index==5){ 
					
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	@import "@/static/css/index/index.scss";
	.mytop {
		margin-bottom: 10px;
	}
	.public_top {
		padding-top: 80px;
	}
	.footer {
		width: 95%;
		// height: 100%;
		margin: auto;
		padding-bottom: 10px;
		.footer_text {
			width: 95%;
			margin: auto;
			background-color: #fff;
			border-radius: 4px;
			padding: 0 0 10px 30rpx;
			.footer_txt {
				height: 70rpx;
				line-height: 70rpx;
				color: #7d7c7c;
				display: flex;
				text {
					padding: 0 0 0 30rpx;
				}
				 display:block;            /*内联对象需加*/
				            word-break:keep-all;      /* 不换行 */
				            white-space:nowrap;    
							overflow:hidden; 
			}
		}
	}
	.icon_style {
		color: rgb(18, 150, 219);
		font-size: 30px;
		position: relative;
	}
	.footer_contact {
		width: 95%;
		margin: auto;
		background-color: #fff;
		.footer_out {
			width: 90%;
			margin: auto;
			display: flex;
			padding: 20rpx 0 20rpx 0;
			justify-content: space-around;
			div {
				text-align: center;
				a {
					text-decoration:none;
					color: #7d7c7c;
				}
				i {
					font-size: 30px;
					color: #1296db;
				}
			}
		}
	}
</style>
